package com.yc.sole.erp.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import com.yc.sole.framework.mybatis.entity.BaseEntity;
import jakarta.persistence.*;
import lombok.Data;

import java.math.BigDecimal;

/**
 * 产品表
 *
 * @author yizuomin
 * @date 2023/5/7 21:50
 **/
@Data
@Entity
@Table(name = "erp_product", uniqueConstraints = {
        @UniqueConstraint(name = "un_prod_detail",
                columnNames = {"moldId", "color", "material", "size", "length"})
})
@TableName("erp_product")
public class Product extends BaseEntity {

    /**
     * 主键
     */
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @TableId(type = IdType.AUTO)
    private Long id;
    /**
     * 模具id
     */
    @Column(columnDefinition = "BIGINT COMMENT '模具id'")
    private Long moldId;
    /**
     * 模具名称
     */
    @Column(columnDefinition = "VARCHAR(50) NOT NULL COMMENT '模具名称'")
    private String moldName;
    /**
     * 产品名称
     */
    @Column(columnDefinition = "VARCHAR(50) NOT NULL COMMENT '产品名称'")
    private String productName;
    /**
     * 单位
     */
    @Column(columnDefinition = "VARCHAR(10) NOT NULL COMMENT '单位'")
    private String unit;
    /**
     * 类别id
     */
    @Column(columnDefinition = "BIGINT NOT NULL COMMENT '类别id'")
    private Long categoryId;
    /**
     * 类别名称
     */
    @Column(columnDefinition = "VARCHAR(50) NOT NULL COMMENT '类别名称'")
    private String categoryName;
    /**
     * 颜色
     */
    @Column(columnDefinition = "VARCHAR(10) NOT NULL COMMENT '颜色'")
    private String color;
    /**
     * 材质
     */
    @Column(columnDefinition = "VARCHAR(10) NOT NULL COMMENT '材质'")
    private String material;
    /**
     * 尺码
     */
    @Column(columnDefinition = "VARCHAR(10) NOT NULL COMMENT '尺码'")
    private String size;
    /**
     * 长度
     */
    @Column(columnDefinition = "VARCHAR(20) NOT NULL COMMENT '尺码'")
    private String length;
    /**
     * 重量
     */
    @Column(columnDefinition = "INT NOT NULL COMMENT '重量'")
    private Integer weight;
    /**
     * 库存数量
     */
    @Column(columnDefinition = "INT NOT NULL COMMENT '尺码'")
    private Integer stock;
    /**
     * 单价
     */
    @Column(columnDefinition = "DECIMAL(18,2) NOT NULL DEFAULT 0.00 COMMENT '单价'")
    private BigDecimal unitPrice;
    /**
     * 是否删除
     */
    @TableLogic
    @Column(columnDefinition = "INT NOT NULL DEFAULT 0 COMMENT '是否已删除'")
    private Integer deleted;
}
